FROM centos:7
MAINTAINER zehua # 指定作者信息
RUN set -ex \
	&& yum -y install zlib-devel bzip2-devel libffi-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make wget \
	&& yum clean all \
	&& mkdir /usr/local/python \
	&& mkdir /data

COPY Python-3.6.5.tar.xz  /data

RUN set -ex \
	&& cd /data \
	&& tar -xvJf  Python-3.6.5.tar.xz \
	&& cd Python-3.6.5 \
	&& ./configure prefix=/usr/local/python \
	&& make && make install \
	&& rm -f /usr/bin/python \
	&& rm -f /usr/bin/pip \
	&& ln -s /usr/local/python/bin/python3 /usr/bin/python \
	&& ln -s /usr/local/python/bin/pip3 /usr/bin/pip

# 修复因修改python版本导致yum失效问题
RUN set -ex \
    && sed -i "s#/usr/bin/python#/usr/bin/python2.7#" /usr/bin/yum \
    && sed -i "s#/usr/bin/python#/usr/bin/python2.7#" /usr/libexec/urlgrabber-ext-down \
    && yum install -y deltarpm

RUN set -ex \
	&& python -V \
	&& pip install --upgrade pip

RUN set -ex \
	&& cd ./semantics-recognise \
	&& pip install -r requirements.txt

